<?php
        	include "thuvien/db.php";
            include "thuvien/error.php";
?>


<?php
	$idXoa = $_REQUEST['idXoa'];
	if(isset($idXoa))
	{
		$cnn = mysql_connect( $hostName, $username, $password );
		if ( ! $cnn )
			showError();
             
        $dbselect = mysql_select_db( $databaseName);
        if(!$dbselect)
            showError();
			
		$table = "hocsinh";
		$query = "DELETE FROM $table WHERE MaHS='$idXoa'"; 
		$result = mysql_query($query, $cnn);
			
			/*

		// XML Preamble
		$xml = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
		
		// Begin XML response
		$xml .= '<xmlresponse>' . "\n";
		
		
		// Build result string

		if (mysql_affected_rows())
		{
			$xml .= '<deleted>1</deleted>' . "\n";
		}
		else
		{
			$xml .= '<deleted>0</deleted>' . "\n";
			$xml .= '<error>' . mysql_error() . '</error>' . "\n";
		}
		
		// End XML response
		$xml .= '</xmlresponse>' . "\n";
		
		// Output XML string
		echo $xml; 
		*/
		
		if (mysql_affected_rows())
		{
			echo "1";
		}
		else
		{
			echo "0";
		}

	}
	
	
	/*
	
	$MaHSs = $_REQUEST['chkMaHSs'];
	if(isset($MaHSs))
	{
		$cnn = mysql_connect( $hostName, $username, $password );
		if ( ! $cnn )
			showError();
				 
		$dbselect = mysql_select_db( $databaseName);
		if(!$dbselect)
			showError();
				
		$table = "hocsinh";
		
		$query = "DELETE FROM $table WHERE ";
		
		$strMa = "MaHS=''";
			
		foreach ($MaHSs as $mahs)
		{
			$temp = "MaHS='" . "$mahs" ."'";
			//echo "Delete .... ".$mahs. "<br/>";
			$strMa = $strMa . " or " .$temp;
			
		}
		
		$query = $query.$strMa ;
		$result = mysql_query($query, $cnn);
		
		if (mysql_affected_rows())
		{
			echo "1";
		}
		else
		{
			echo "0";
		}
	}
	*/
	
	
?>
